import request from '@/utils/request'

enum API {
  TRADEMARK_LIST = '/admin/product/baseTrademark/',
  UPDATE_TRADEMARK = '/admin/product/baseTrademark/update',
  ADD_TRADEMARK = '/admin/product/baseTrademark/save',
  DELETE_TRADEMARK = '/admin/product/baseTrademark/remove',
}
import type { TradeMarkResponseData, TradeMark } from './type'
// 获取品牌列表数据
export const getTrademarkList = (page: number, limit: number) => {
  return request.get<any, TradeMarkResponseData>(
    API.TRADEMARK_LIST + `${page}/${limit}`,
  )
}

export const updateTrademark = (data: TradeMark) => {
  if (data.id) {
    return request.put<any, any>(API.UPDATE_TRADEMARK, data)
  } else {
    return request.post<any, any>(API.ADD_TRADEMARK, data)
  }
}

export const deleteTrademark = (id: any) => {
  return request.delete<any, any>(API.DELETE_TRADEMARK + `/${id}`)
}
